home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18292 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: macromedia.com!news
  2. From: Mark Sanford <msanford@macromedia.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: HELP!! Using STL with Visual C++ 4.1
  5. Date: Fri, 19 Apr 1996 14:09:44 -0700
  6. Organization: Macromedia
  7. Message-ID: <31780118.6204@macromedia.com>
  8. NNTP-Posting-Host: 207.3.33.142
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (Macintosh; I; PPC)
  13.  
  14. I'm trying to use the STL in my applications using the Visual
  15. C++ compiler.  I've taken the steps suggested by Microsoft
  16. reguarding the use of namespaces and min/max definitions.  But
  17. the compiler still chokes on line 124 of defalloc.h:
  18.  
  19. 122   template <class T1, class T2>
  20. 123   inline void construct(T1* p, const T2& value) {
  21. 124       new (p) T1(value);
  22. 125   }
  23.  
  24. The error is:
  25.  
  26. error C2661: 'new' : no overloaded function takes 2 parameters
  27.  
  28. This error comes up anytime I actually USE any of the STL
  29. templates.  i.e. Simply adding this line of code causes the error:
  30.  
  31.     std::vector<int> x(10);
  32.  
  33. I've tried STL sample code, and it causes the same error...
  34. BTW I looked in new.h (included in defalloc.h) and the new
  35. placement operator is defined:
  36.  
  37.     inline void * operator new( size_t, void * ptr ) { return ptr; }
  38.  
  39. Has anybody else run into this problem? Any ideas on a solution?
  40.  
  41. Mark Sanford
  42. msanford@macromedia.com
  43.